package com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.voip;

import com.alstudio.module.xmpp.protocol.xmpp.packact.ALXmppDomainConfig;
import com.alstudio.module.xmpp.protocol.xmpp.packact.IQNameSpace;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.AlXmlTag;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.BaseIQTemplate;

public class VoipChargeIQCreator extends BaseIQTemplate {

	private String sessionId;

	public VoipChargeIQCreator(String sessionId, String domain) {
		// TODO Auto-generated constructor stub
		this.sessionId = sessionId;
		this.domain = domain;
	}

	@Override
	public String getIQXml() {
		// TODO Auto-generated method stub

		to = ALXmppDomainConfig.getALXmppDomainConfig()
				.getDomainByNameSpace(IQNameSpace.NS_VOIP_CHARGE);
		mALIQCreator.setTo(to + domain);
		mALIQCreator.setNs(IQNameSpace.NS_VOIP_CHARGE);
		mALIQCreator.setType(IQ_TYPE_SET);

		AlXmlTag sessionTag = new AlXmlTag("sessionid");
		sessionTag.setText(sessionId);
		tagList.add(sessionTag);

		String xml = "";
		try {
			xml = mALIQCreator.getXml();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return xml;
	}

}
